package com.crungoo.springaop.adives;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * MethodInterceptor 与Cglib的MethodInterceptor是不一样的。
 * <p>
 * 可以理解为：手动的去调用被代理的方法。
 * </p>
 *
 * @author fujc-dev@qq.com
 * @date 2023/7/28 11:24
 */
public class MyAroundAdvice implements MethodInterceptor {

	@Nullable
	@Override
	public Object invoke(@NotNull MethodInvocation invocation) throws Throwable {
		System.out.println("方法执行Around前");
		// 执行被代理的方法
		Object proceed = invocation.proceed();
		System.out.println("方法执行Around后");
		return proceed;
	}
}
